import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;

/*public class Main {
    public static void main(String[] args) {
        int[] array = {100, 12, 31, 14, 15};
        System.out.println(myToString(array));

    }

    public static String myToString(int[] array) {
        String ret = "[";
        for (int i = 0; i < array.length; i++) {
            ret += array[i];

            if (i != array.length - 1) {
                ret += ", ";
            }
        }
        ret += "]";
        return ret;
    }
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int ret = fac(n);
       System.out.println(ret);
   }
   public static int fac(int n){
       int r = 1;
       for(int i =1;i<=n;i++){
           r*=i;
       }
       return r;
   }
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
       int sum = 0;
       for (int i = 1; i <= n; i++) {
           sum+=fac(i);
       }
       System.out.println(1+"到"+n+"的阶乘和为"+sum);
   }
   public static int  fac(int n){
       if(n==1){
           return n;
       }else{
           return fac(n-1)*n;
       }
   }
   public static void main(String[] args) {
       System.out.println(max3(3, 4,5));
   }
   public static int max2(int a,int b){
        int ret =  a>b?a:b;
        return ret;
   }
   public static int max3(int a,int b, int c){
       return (max2(3,4)>5?max2(3,4):5);

   }
   public static void main(String[] args) {
       System.out.println(fac(10));
   }
   public static int fac(int n){
       int f1 = 1;
       int f2 = 1;
       int f3 = 2;
       if(n==1||n==2){
           return n;
       }
    for(int i =3;i<n;i++){
           f3 = f1+f2;
           f1 = f2;
           f2 = f3;
       }
       return f3;
   }
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
       int n = sc.nextInt();
      System.out.println(ret(n));
   }
   public static int ret(int n){
      if(n==1||n==2){
         return n;
      }else{
         return ret(n-1)*n;
      }
   }
    public static void main(String[] args) {
       System.out.println(add(10));
    }
    public static int add(int n){
       int sum = 0;
       if(n==1){
          sum+=1;
          return sum;
       }else{
          return add(n-1)+n;
       }
    }

    public static void main(String[] args) {
        Scanner sc =new  Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(sum(n));
    }
    public static int sum(int n){
        if(n<0){
            n = -n;
        }
        int s = 0;
        if(n<10){
            return s+=n;
        }else{
            return sum(n/10)+n%10;
        }
    }

    public static void main(String[] args) {
        System.out.println(fac(10));
    }
    public static int fac(int n){
      if(n==1||n==2){
          return 1;
      }else{
          return fac(n-1)+fac(n-2);
      }
    }
}
*/
public class Main {
    /*public static void main(String[] args) {
        sum(2,3);
        sum(1.4,1.5,7.5);
    }
    public static void sum(int a,int b){
        int s = 0;
        s =a+b;
        System.out.println(s);
    }
    public static void sum(double a,double b,double c){
        double s = 0;
        s = a+b+c;
        System.out.println(s);
    }
    public static void main(String[] args) {
        max(2,3);
        max(1.4,1.5,7.5);
    }
    public static void max(int a,int b){

        System.out.println(a>b?a:b);
    }
    public static void max(double a,double b,double c){

        System.out.println((a>b?a:b)>c?(a>b?a:b):c);
    }

    public static void main(String[] args) {
        int[] array = {0, 0, 2, 3, 4, 4, 1, 3, 2};
        int m = 0;
        int[] array2 = new int[9];
        for (int i = 0; i < array.length; i++) {
            for (int j = 1 + i; j < array.length; j++) {
                if (array[i] == array[j]) {
                    array2[m++] = array[i];
                    break;
                }
            }
        }
        for (int i = 0; i < array2.length; i++) {
            System.out.println(array2[i]);
        }
    }

    public static void main(String[] args) {
        int[] arry ={1,2,3,4,5,6};
        int[] arry1= new int[6];
        int m =0;
        for (int i = 0; i < arry.length; ) {
            if(i%2==0){
                arry1[m++]=arry[i];

            }else{
                int n=6;
                arry1[n--] = arry[i];
            }
        }
        for(int i = 0;i<arry1.length;i++){
            System.out.print(arry1[i]+" ");
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(jump(n));
    }

    public static int jump(int n) {

        if (n == 1 || n == 2) {
            return n;
        } else {
            return jump(n - 1) + jump(n - 2);
        }
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        hannuota(n,"A塔","B塔","C塔");
        double ret = Math.pow(2,n)-1;
        System.out.println("至少要移动"+ret+"次");
    }
    public static void hannuota(int n ,String a,String b,String c ){
        if(n==1){
            System.out.println("将第一模块"+a+"移动到"+c+"处");
        }else {
            hannuota(n-1,a,c,b);
            System.out.println("将"+n+"模块从"+a+"移到"+c+"处");
            hannuota(n-1,b,a,c);
        }
    }
    public static void main(String[] args) {
        int[] array ={2,4,6,1,3,5};
        fun3(array);
        System.out.println(Arrays.toString(array));
    }
    public static void fun3(int[] array){
        int i = 0;
        int j = array.length-1;
        while(i<j){
            while(i<j&&array[i]%2!=0){
                i++;
            }
            //i下标就是一个偶数
            while(i<j&&array[j]%2==0){
                j--;
            }
            //j下标就是一个奇数
            int temp = array[i];
            array[i] = array[j];
            array[j] = temp;
        }
    }
    public static void main(String[] args) {
        int[] array={2,3,6,8,1};
        System.out.println(binarySearch(array, 2));
        System.out.println(binarySearch(array, 10));
        System.out.println(binarySearch(array, 6));
        System.out.println(Arrays.binarySearch(array,8));
    }
    public static int binarySearch(int[] array,int key){
        int i = 0;
        int j = array.length-1;
        while(i<=j){
            int mid = (i+j)/2;
            if(array[mid]<key){
                i = mid +1;
            }else if(array[mid]==key){
                return mid;
            }else{
                j = mid-1;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        System.out.println(print(1234));
    }
    public static int print(int n){
        if(n<10){
            return n;
        }else{
            int ret = print(n/10)+n%10;
        return ret;
        }
    }
    public static void main(String[] args) {
        int[] array = {2, 3, 6, 4};
        int ret[] = findNum(array, 7);
        System.out.println(Arrays.toString(ret));
    }

    public static int[] findNum(int[] array, int target) {
        int[] ret = {-1, -1};
        for (int i = 0; i < array.length; i++) {
            for (int j = i + 1; j < array.length; j++) {
                if (array[i] + array[j] == target) {
                    ret[0] = i;
                    ret[1] = j;
                }

            }
        }

        return ret;
    }
     */












